package com.wunu.smartlock

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
import com.billy.cc.core.component.CC

class MainActivity : AppCompatActivity() {

    public final val COMPONENT_SMART_LOCK = "wunu.smartlock"
    public final val COMPONENT_SMART_LOCK_ACTION = "showActivity"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val textView = findViewById<TextView>(R.id.textView)
        textView.setOnClickListener {
            CC.obtainBuilder(COMPONENT_SMART_LOCK)
                    .setActionName(COMPONENT_SMART_LOCK_ACTION)
                    .build()
                    .callAsyncCallbackOnMainThread { cc, result ->
                        textView.text = result.toString()
                    }
        }
    }
}
